//
// C++ Interface: menu
//
// Description: 
//
//
// Author: Os3 s.r.l. <xgui@os3.it>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//

namespace xgui
{
	class Image;
    %feature("docstring","**DESCRIPTION**\n\nderives from :class:`xgui.WidgetClass`") MenuClass;
	struct MenuClass : public xgui::WidgetClass
	{
		MenuClass();
		std::string const &className();
		bool isInstanceable();
		xgui::Object * create(xgui::Object * parent, xgui::StringMap &properties);

		virtual bool canContain(xgui::ClassInfo * c);
		virtual bool canBeContainedIn(xgui::ClassInfo * c);
	};
    %feature("docstring","**DESCRIPTION**\n\nderives from :class:`xgui.Widget` \n\n**PROPERTIES**\n\nnone.\n\n**EVENTS**\n\n* **onselect** *(linked to* :class:`xgui.TextStatusCallback` *):* fired when the user clicks on a menu item the string parameter of the callback function represents the id of the clicked menu item. The status parameter is set to *1* if the clicked menu item has been checked, otherwise is set to *0* . \n\n**METHODS**\n\n") Menu;
	class Menu : public xgui::Widget
	{
		protected:
			Menu(xgui::Window * parent, bool visible);
			virtual ~Menu();

		public:
		    %feature("docstring","adds a new menu item. <parent_id> specifies the id of the parent menu item, or empty string if the item is to be added at to root level.<id> is an identification string assigned to the new menu item. <text> is the displayed menu item text. <icon> is an optional pointer to an image to be displayed near the menu item text. <type> can be an empty string for a standard menu item, or one of the following values:\n\n * *\"separator\"* -> creates a line separator;\n\n * *\"check\"* -> creates a menu item which can be checked/unchecked (the item will have a small icon that marks the check state);\n\n * *\"radio_begin\"* -> pseudo-item (not visible) that marks the beginning of a radio item group;\n\n * *\"radio_end\"* -> pseudo-item (not visible) that marks the end of a radio item group.\n\n*C++*::\n\n void addItem(std::string const &parent_id,std::string const &id,std::string const &text,xgui::Image * icon=0,std::string const & type=\"\");\n\n") addItem;
			void addItem(std::string const &parent_id, std::string const &id, std::string const &text, xgui::Image * icon = 0, std::string const & type = "" );
			%feature("docstring","removes the specified menu item\n\n*C++*::\n\n void delItem(std::string const &id);\n\n") delItem;
			void delItem(std::string const &id);

            %feature("docstring","displayes the popup-menu identified by <id> at the current mouse position.\n\n*C++*::\n\n void popupMenu(std::string const &id);\n\n") popupMenu;
			void popupMenu(std::string const &id);

            %feature("docstring","enables the specified menu item (the item can be clicked or selected)\n\n*C++*::\n\n void enableItem(std::string const &id);\n\n") enableItem;
			void enableItem(std::string const &id);
			%feature("docstring","disables the specified menu item (the item can't be clicked or selected and is displayed in gray)\n\n*C++*::\n\n void disableItem(std::string const &id);\n\n") disableItem;
			void disableItem(std::string const &id);
			%feature("docstring","returns true if the specified item is enabled, false otherwise.\n\n*C++*::\n\n bool isItemEnabled(std::string const &id);\n\n") isItemEnabled;
			bool isItemEnabled(std::string const &id);
			
			%feature("docstring","marks the specified checkable menu item as checked\n\n*C++*::\n\n void checkItem(std::string const &id);\n\n") checkItem;
			void checkItem(std::string const &id);
			%feature("docstring","removes a check from the checkable checkable menu item\n\n*C++*::\n\n void uncheckItem(std::string const &id);\n\n") uncheckItem;
			void uncheckItem(std::string const &id);
			%feature("docstring","returns true if the specified menu item is checked, false otherwise\n\n*C++*::\n\n bool isItemChecked(std::string const &id);\n\n") isItemChecked;
			bool isItemChecked(std::string const &id);
			
			%feature("docstring","changes the text of the specified menu item\n\n*C++*::\n\n void setItemText(std::string const &id, std::string const &text);\n\n") setItemText;
			void setItemText(std::string const &id, std::string const &text);
			%feature("docstring","returns the text of the specified menu item\n\n*C++*::\n\n std::string getItemText(std::string const &id);\n\n") getItemText;
			std::string getItemText(std::string const &id);
	};
}

%extend xgui::Menu {
	%pythoncode {
		def __del__(self):
			if self.valid: self.delPyOwner(self)
	}
}

